 #include "ros/ros.h"
   #include "std_msgs/String.h"
   #include <sstream>
    void chatterCallback(const std_msgs::String::ConstPtr& msg)
   {
     ROS_INFO("CatchMsg1: [%s]", msg->data.c_str());
   }
   int main(int argc, char **argv)
   {
     ros::init(argc, argv, "ly");

     ros::NodeHandle n;

     ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter1", 1000);
     ros::Subscriber sub = n.subscribe("chatter2", 1000, chatterCallback);
     ros::Rate loop_rate(1);

     int count = 0;
     while (ros::ok())
     {
     
       std_msgs::String msg;
   
       std::stringstream ss;
       ss << "ly" << count;
       msg.data = ss.str();
   
      chatter_pub.publish(msg);
  
      ros::spinOnce();
  
      loop_rate.sleep();
      ++count;
    
    }
    return 0;
  }
